﻿{include file="public/_meta" /}
<title>管理员列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 管理员管理 <span class="c-gray en">&gt;</span> 管理员列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
	<div class="text-c"> 
		<form class="Huiform" method="get" action="">
		<input type="text" class="input-text" style="width:150px" placeholder="工号、账户、手机" value="{$Request.get.keywords|default=''}" id="" name="keywords">
		<button type="submit" class="btn btn-success" id="" ><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
		</form>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> 
		<span class="l">
			<!-- <a href="javascript:;" onclick="admin_add('添加','add.html','800','500')" class="btn btn-primary radius"> -->
			<a href="javascript:;" onclick="create(0,'add','添加管理员')" class="btn btn-primary radius">

			<i class="Hui-iconfont">&#xe600;</i> 管理员</a>
		</span> 
		<span class="r">共有数据：<strong>{$list->total()}</strong> 条</span>
	 </div>
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr class="text-c">
				<th width="60">工号</th>
				<th width="60">姓名</th>
				<th width="120">手机/账号</th>
				<th width="90">角色</th>
				<th width="150">添加时间</th>
				<th width="100">是否已启用</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			{volist name='list' id="vo"}
			<tr class="text-c">
				<td>{$vo.ad_work_number}</td>
				<td>{$vo.ad_name}</td>
				<td>
					{if $vo.ro_id eq 3}{$vo.ad_tel}<br>可交易金额：{$vo.gong_pay_money}<br>冻结金额：{$vo.gong_money}
					{else /}{$vo.ad_tel}
					{/if}
				</td>
				<td>
					<select name="ro_id" onchange="change({$vo.id},$(this).val(),'ro_id')" >
						{volist name="ro_list" id="v"}
						<option value="{$v.id}" {if condition="$vo.ro_id eq $v.id"}selected{/if}>{$v.ro_name}</option>
						{/volist}
					</select>
				</td>
				<td>{$vo.add_time}</td>
				<td class="td-status">
					{if condition="$vo.status eq 1"}
						<span class="label label-success radius">已启用</span>
					{else/}
						<span class="label label-default radius">已禁用</span>
					{/if}
				</td>
				<td class="td-manage">
					{if condition="$vo.status eq 1"}
						<a style="text-decoration:none" onClick="change({$vo.id},0,'status')" href="javascript:;" title="停用"><i class="Hui-iconfont">&#xe631;</i></a> 
					{else/}
						<a onClick="change({$vo.id},1,'status')" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>
					{/if}
					<a title="编辑" href="javascript:;" onclick="create({$vo.id},'edit','修改管理员')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
					<a onclick="del({$vo.id},'Admin')" style="text-decoration:none"><i class="Hui-iconfont" title="删除">&#xe60b;</i></a>
				</td>
			</tr>
			{/volist}
		</tbody>
	</table>
	<div class="pages" style="margin:20px;float: right; ">{$list|raw}</div>
</div>
{include file="public/_footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
// function admin_add(title,url,w,h){
// 	layer_show(title,url,w,h);
// }
function create(id,url,key){
	var url = "{:url('"+url+"')}?id="+id;
	creatIframe(url,key);
}
function change(id,value,key){
	layer.confirm('确定要更改么？', {
	      btn: ['确定', '取消']
	    }, function(index, layero){
	        $.ajax({
	            type: "post",
	            url: "{:url('change')}",
	            data: {id:id,value:value,key:key},
	            success: function(data) {
	             	if(data.code){
	             		location.href = '';
	             	}else{
	             		layer.msg(data.msg);
	             	}
	            }
	        });
	    });
}

function del(id,key){
    layer.confirm('确定要删除么？', {
      btn: ['确定', '取消']
    }, function(index, layero){
        $.ajax({
            type: "post",
            url: "{:url('Admin/deleteAdmin')}",
            data: {id:id,key:key},
            success: function(data) {
                layer.msg(data.msg);
                if(data.code==1){
                    setTimeout(function(){
                        location.href = data.url;
                    },1000);
                }
            }
        });
    });
}
</script>
</body>
</html>